home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 526-550 / disk_540 / sana / sana2device.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  8KB  |  258 lines

  1. #ifndef SANA2_SANA2DEVICE_H
  2. #define SANA2_SANA2DEVICE_H 1
  3. /*
  4. **    $Filename: sana2device.h $
  5. **    $Release: Developer Information$
  6. **    $Revision: 1.10 $
  7. **    $Date: 91/05/14 $
  8. **
  9. **    Structure definitions for SANA-II devices.
  10. **
  11. **    (C) Copyright 1991 Commodore-Amiga Inc.
  12. **        All Rights Reserved
  13. */
  14.  
  15. /*
  16. ** Contributions from:
  17. **    Raymond S. Brand,   rsbx@cbmvax.commodore.com,  (215) 431-9100
  18. **    Martin Hunt,      martin@cbmvax.commodore.com,  (215) 431-9100
  19. **    Perry Kivolowitz,           ASDG Incorporated,  (608) 273-6585
  20. */
  21.  
  22.  
  23. #ifndef EXEC_TYPES_H
  24. #include <exec/types.h>
  25. #endif /* !EXEC_TYPES_H */
  26. #ifndef EXEC_PORTS_H
  27. #include <exec/ports.h>
  28. #endif /* !EXEC_PORTS_H */
  29. #ifndef EXEC_IO_H
  30. #include <exec/io.h>
  31. #endif /* !EXEC_IO_H */
  32. #ifndef DEVICES_TIMER_H
  33. #include <devices/timer.h>
  34. #endif /* !DEVICES_TIMER_H */
  35. #ifndef LIBRARIES_NETBUFF_H
  36. #include <libraries/netbuff.h>
  37. #endif /* !LIBRARIES_NETBUFF_H */
  38.  
  39.  
  40. #define SANA2_MAX_ADDR_BITS    (128)
  41. #define SANA2_MAX_ADDR_BYTES    ((SANA2_MAX_ADDR_BITS+7)/8)
  42.  
  43.  
  44. struct IOSana2Req
  45.     {
  46.     struct Message S2io_Message;
  47.     struct Device *S2io_Device;    /* device node pointer        */
  48.     struct Unit   *S2io_Unit;    /* unit (driver private)    */
  49.  
  50.     UWORD S2io_Command;        /* device command        */
  51.     UBYTE S2io_Flags;        /* command flags        */
  52.     BYTE  S2io_Error;        /* generic error or warning    */
  53.     ULONG S2io_WireError;        /* wire type specific error    */
  54.  
  55.     struct Sana2PacketType *S2io_PacketType;    /* packet type    */
  56.     UBYTE S2io_SrcAddr[SANA2_MAX_ADDR_BYTES];    /* source addr    */
  57.     UBYTE S2io_DstAddr[SANA2_MAX_ADDR_BYTES];    /* dest address    */
  58.     ULONG S2io_DataLength;        /* from header            */
  59.     struct NetBuff S2io_Body;    /* packet data            */
  60.     void *S2io_StatData;        /* statics data pointer        */
  61.     };
  62.  
  63.  
  64. /*
  65.  * defines for the S2io_Flags field
  66.  */
  67.  
  68. #define SANA2IOB_RAW    (7)        /* raw packet IO requested    */
  69. #define SANA2IOF_RAW    (1<<SANA2IOB_RAW)
  70.  
  71. #define    SANA2IOB_BCAST    (6)        /* broadcast packet (received)    */
  72. #define    SANA2IOF_BCAST    (1<<SANA2IOB_BCAST)
  73.  
  74. #define    SANA2IOB_MCAST    (5)        /* multicast packet (received)    */
  75. #define    SANA2IOF_MCAST    (1<<SANA2IOB_MCAST)
  76.  
  77. #define SANA2IOB_QUICK    (IOB_QUICK)    /* quick IO requested (0)    */
  78. #define SANA2IOF_QUICK    (IOF_QUICK)
  79.  
  80.  
  81. /*
  82.  * defines for OpenDevice()
  83.  */
  84.  
  85. #define SANA2OPB_MINE    (0)        /* exclusive access requested    */
  86. #define SANA2OPF_MINE    (1<<SANA2OPB_MINE)
  87.  
  88. #define SANA2OPB_PROM    (1)        /* promiscuous mode requested    */
  89. #define SANA2OPF_PROM    (1<<SANA2OPB_PROM)
  90.  
  91.  
  92. struct Sana2PacketType
  93.     {
  94.     ULONG CanonicalType;        /* used by higher levels    */
  95.     ULONG Magic;            /* interpretation code        */
  96.     ULONG Length;            /* length of match data        */
  97.     UBYTE *Match;            /* bytes to compare        */
  98.     UBYTE *Mask;            /* mask for comparison        */
  99.     };
  100.  
  101.  
  102. struct Sana2DeviceQuery
  103.     {
  104.     /*
  105.      * Standard information
  106.      */
  107.     ULONG    SizeAvailable;        /* bytes available        */
  108.     ULONG    SizeSupplied;        /* bytes supplied        */
  109.     LONG    DevQueryFormat;        /* this is type 0        */
  110.     LONG    DeviceLevel;        /* this document is level 0    */
  111.     /*
  112.      * Common information
  113.      */
  114.     UWORD    AddrFieldSize;        /* address size in bits        */
  115.     ULONG    MTU;            /* maximum packet data size    */
  116.     LONG    bps;            /* line rate (bits/sec)        */
  117.     LONG    HardwareType;        /* what the wire is        */
  118.     /*
  119.      * Format specific information
  120.      */
  121.     };
  122.  
  123.  
  124. /*
  125.  * defined Hardware types
  126.  */
  127.  
  128. #define S2WireType_Ethernet        1
  129. #define S2WireType_Arcnet        2
  130.  
  131.  
  132. struct Sana2PacketTypeStats
  133.     {
  134.     LONG PacketsSent;        /* transmitted count        */
  135.     LONG PacketsReceived;        /* received count        */
  136.     LONG BytesSent;            /* bytes transmitted count    */
  137.     LONG BytesReceived;        /* bytes received count        */
  138.     LONG PacketsDropped;        /* packets dropped count    */
  139.     };
  140.  
  141.  
  142. struct Sana2SpecialStatRecord
  143.     {
  144.     ULONG Type;            /* statistic identifier        */
  145.     LONG Count;            /* the statistic        */
  146.     char *String;            /* statistic name        */
  147.     };
  148.  
  149.  
  150. struct Sana2SpecialStatHeader
  151.     {
  152.     ULONG RecordCountMax;        /* room available        */
  153.     ULONG RecordCountSupplied;    /* number supplied        */
  154.     /* struct Sana2SpecialStatRecord[RecordCountMax]; */
  155.     };
  156.  
  157.  
  158. struct Sana2DeviceStats
  159.     {
  160.     LONG packets_received;        /* received count        */
  161.     LONG packets_sent;        /* transmitted count        */
  162.     LONG framing_errors;        /* framming errors found    */
  163.     LONG bad_data;            /* bad packets received        */
  164.     LONG hard_misses;        /* hardware miss count        */
  165.     LONG soft_misses;        /* software miss count        */
  166.     LONG unknown_types_received;    /* orphan count            */
  167.     LONG fifo_overruns;        /* hardware overruns        */
  168.     LONG fifo_underruns;        /* hardware underruns        */
  169.     LONG reconfigurations;        /* network reconfigurations    */
  170.     struct timeval last_start;    /* time of last online        */
  171.     };
  172.  
  173.  
  174. /*
  175.  * Device Commands
  176.  */
  177.  
  178. #define SANA2_CMD_START            (CMD_NONSTD)
  179.  
  180. #define SANA2CMD_DEVICEQUERY        (SANA2_CMD_START+ 0)
  181. #define SANA2CMD_GETSTATIONADDRESS    (SANA2_CMD_START+ 1)
  182. #define SANA2CMD_CONFIGINTERFACE    (SANA2_CMD_START+ 2)
  183. #define SANA2CMD_ADDSTATIONALIAS    (SANA2_CMD_START+ 3)
  184. #define SANA2CMD_DELSTATIONALIAS    (SANA2_CMD_START+ 4)
  185. #define SANA2CMD_ADDMULTICASTADDRESS    (SANA2_CMD_START+ 5)
  186. #define SANA2CMD_DELMULTICASTADDRESS    (SANA2_CMD_START+ 6)
  187. #define SANA2CMD_MULTICAST        (SANA2_CMD_START+ 7)
  188. #define SANA2CMD_BROADCAST        (SANA2_CMD_START+ 8)
  189. #define SANA2CMD_TRACKTYPE        (SANA2_CMD_START+ 9)
  190. #define SANA2CMD_UNTRACKTYPE        (SANA2_CMD_START+10)
  191. #define SANA2CMD_GETTYPESTATS        (SANA2_CMD_START+11)
  192. #define SANA2CMD_GETSPECIALSTATS    (SANA2_CMD_START+12)
  193. #define SANA2CMD_GETGLOBALSTATS        (SANA2_CMD_START+13)
  194. #define SANA2CMD_ONEVENT        (SANA2_CMD_START+14)
  195. #define SANA2CMD_READORPHAN        (SANA2_CMD_START+15)
  196. #define SANA2CMD_ONLINE            (SANA2_CMD_START+16)
  197. #define SANA2CMD_OFFLINE        (SANA2_CMD_START+17)
  198.  
  199. #define SANA2_CMD_END            (SANA2_CMD_START+18)
  200.  
  201.  
  202. /*
  203.  * defined errors for S2io_Error
  204.  */
  205.  
  206. #define S2ERR_NO_ERROR        0    /* peachy-keen            */
  207. #define S2ERR_NO_RESOURCES    1    /* resource allocation failure    */
  208. #define S2ERR_UNKNOWN_ENTITY    2    /* unable to find something    */
  209. #define S2ERR_BAD_ARGUMENT    3    /* garbage somewhere        */
  210. #define S2ERR_BAD_STATE        4    /* inappropriate state        */
  211. #define S2ERR_BAD_ADDRESS    5    /* who?                */
  212. #define    S2ERR_MTU_EXCEEDED    6    /* too much to chew        */
  213. #define    S2ERR_BAD_PROTOCOL    7    /* bad packet type structure    */
  214. #define S2ERR_NOT_SUPPORTED    8    /* command not supported    */
  215. #define S2ERR_SOFTWARE        9    /* software error detected    */
  216.  
  217.  
  218. /*
  219.  * defined errors for S2io_WireError
  220.  */
  221.  
  222. #define S2WERR_GENERIC_ERROR    0    /* no specific info available    */
  223. #define    S2WERR_NOT_CONFIGURED    1    /* unit not configured        */
  224. #define S2WERR_UNIT_ONLINE    2    /* unit is currently online    */
  225. #define S2WERR_UNIT_OFFLINE    3    /* unit is currently offline    */
  226. #define    S2WERR_ALREADY_TRACKED    4    /* protocol already tracked    */
  227. #define    S2WERR_NOT_TRACKED    5    /* protocol not tracked        */
  228. #define S2WERR_NETBUFF_ERROR    6    /* netbuff.lib returned error    */
  229. #define S2WERR_SRC_ADDRESS    7    /* source address problem    */
  230. #define S2WERR_DST_ADDRESS    8    /* destination address problem    */
  231. #define S2WERR_BAD_BROADCAST    9    /* broadcast address problem    */
  232. #define S2WERR_BAD_MULTICAST    10    /* multicast address problem    */
  233. #define S2WERR_ALIAS_LIST_FULL    11    /* station alias list full    */
  234. #define S2WERR_BAD_ALIAS    12    /* bad station alias        */
  235. #define S2WERR_MULTICAST_FULL    13    /* multicast address list full    */
  236. #define S2WERR_BAD_EVENT    14    /* unsupported event class      */
  237. #define S2WERR_BAD_STATDATA    15    /* statdata failed sanity check */
  238. #define S2WERR_PROTOCOL_UNKNOWN    16    /* unknown protocol type        */
  239. #define S2WERR_IS_CONFIGURED    17    /* attempt to config twice      */
  240. #define S2WERR_NULL_POINTER    18    /* null pointer detected        */
  241.  
  242.  
  243. /*
  244.  * defined events
  245.  */
  246.  
  247. #define    S2EVENT_ERROR        0    /* error catch all        */
  248. #define    S2EVENT_TX        1    /* transmitter error catch all    */
  249. #define    S2EVENT_RX        2    /* receiver error catch all    */
  250. #define    S2EVENT_ONLINE        3    /* unit is in service        */
  251. #define    S2EVENT_OFFLINE        4    /* unit is not in service    */
  252. #define    S2EVENT_NETBUF        5    /* NetBuff error catch all    */
  253. #define S2EVENT_HARDWARE    6    /* hardware error catch all    */
  254. #define S2EVENT_SOFTWARE    7    /* software error catch all    */
  255.  
  256.  
  257. #endif    /* SANA2_SANA2DEVICE_H */
  258.